<%@ page import="ghr.day0109.travelt.dao.ScenicDao" %>
<%@ page import="ghr.day0109.travelt.dao.impl.ScenicDaoImpl" %>
<%@ page import="ghr.day0109.travelt.dao.RouteDao" %>
<%@ page import="ghr.day0109.travelt.dao.impl.RouteDaoImpl" %>
<%@ page import="ghr.day0109.travelt.dao.RelationDao" %>
<%@ page import="ghr.day0109.travelt.dao.impl.RelationDaoImpl" %>
<%@ page import="ghr.day0109.travelt.entity.TourRoute" %>
<%@ page import="java.util.List" %>
<%@ page import="ghr.day0109.travelt.entity.ScenicSpot" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: Gong
  Date: 2023/1/9
  Time: 19:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <title>青游旅行社服务平台</title>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path +
                "/css/ghr/travelt/index.css";
    %>
    <link rel="stylesheet" href="<%=basePath%>" type="text/css">

<%--    <%--%>
<%--        ScenicDao scenicDao = new ScenicDaoImpl();--%>
<%--        RouteDao routeDao = new RouteDaoImpl();--%>
<%--        List<TourRoute> routeList = routeDao.queryAllTourRoute();--%>
<%--        request.setAttribute("route", routeList);--%>
<%--        String type = "";--%>

<%--        String index = String.valueOf(request.getAttribute("index")) == null ? "" :--%>
<%--                String.valueOf(request.getAttribute("index"));--%>
<%--        List<ScenicSpot> spots = scenicDao.queryAllScenic();--%>
<%--        String[] str = index.split(",");--%>
<%--        request.setAttribute("str", str);--%>

<%--    %>--%>
</head>
<body>
<div>
    <div id="A">
        <div class="tittle">
            <strong>青游旅行社服务平台</strong>
        </div>

        <div id="con">
            <button class="custom-btn btn" onclick="location.href='jsp/ghr/travelt/add.jsp'"><span>添&nbsp;加</span></button>
        </div>
        <div>
            <div>
                <br><br>
                <table id="table">
                    <tr>
                        <th>旅游路线名称</th>
                        <th>类型</th>
                        <th>价格(元)</th>
                        <th>咨询电话</th>
                        <th>咨询人</th>
                        <th>创建日期</th>
                        <th>操作</th>
                    </tr>
                    <c:forEach items="${route}" var="r">
                        <tr>
                            <td>${r.trName}</td>
                            <td><c:choose>
                                <c:when test="${r.trType ==1}">自由行</c:when>
                                <c:otherwise>纯玩团</c:otherwise>
                            </c:choose>
                            </td>
                            <td>${r.trPrice}</td>
                            <td>${r.trPhone}</td>
                            <td>${r.trPhone}</td>
                            <td>${r.createTime}</td>
                            <td>
                                <a href="jsp/ghr/travelt/datailsControl.jsp?id=${r.trID}" name="detail">详情</a>
                                <a href="jsp/ghr/travelt/deleteControl.jsp?id=${r.trID}" name="del">删除</a>
                            </td>
                        </tr>

                    </c:forEach>
                </table>
            </div>
            <div>
                <br><br><br><br>
                <table id="details">
                    <tr>
                        <th>景点名称</th>
                        <th>建议游玩时常</th>
                        <th>景点介绍</th>
                    </tr>
                    <c:forEach items="${index}" var="i">


                        <tr>
                            <td>${i.ssName}</td>
                            <td>${i.ssDuration}</td>
                            <td>${i.ssContent}</td>
                        </tr>
                    </c:forEach>

                </table>
            </div>
        </div>
    </div>
</div>
</body>
</html>
